package com.hanter.demo.memoryleak;

import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;


public class Test2Activity extends AppCompatActivity {

    private Handler mHandler = new MyHandler(this);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

//        newTask();
    }

    private void newTask() {
        Thread task = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(60000);
                    mHandler.obtainMessage(0).sendToTarget();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }
        });

        task.start();
    }

}
